home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue39 / construc / VISITLOG.DPR < prev    next >
Encoding:
Text File  |  1998-10-06  |  1.1 KB  |  37 lines

  1. program VisitLog;
  2. {$APPTYPE CONSOLE}
  3. {$I-}
  4. uses
  5.   SysUtils, DrBobCGI;
  6. var
  7.   log: Text;
  8. const
  9.   Gif =
  10.      #71#73#70#56#55#97#1#0#1#0#179#0#0#175#191#207#181+
  11.    #198#215#186#203#220#255#255#255#255#255#255#255#255+
  12.    #255#255#255#255#255#255#255#255#255#255#255#255#255+
  13.    #255#255#255#255#255#255#255#255#255#255#255#255#255+
  14.    #255#255#0#0#0#44#0#0#0#0#1#0#1#0#0#4#2#48#68#0#59#0;
  15. begin
  16.   writeln('content-type: image/gif');
  17.   writeln;
  18.   writeln(Gif);
  19.   { LOG }
  20.   ChDir('_private');
  21.   ShortDateFormat := 'YYYYMMDD';
  22.   System.Assign(log,DateToStr(Now) + '.trk');
  23.   if not FileExists(DateToStr(Now) + '.trk') then
  24.     Rewrite(log) // create on new day
  25.   else Append(log);
  26.   ShortDateFormat := 'YYYY/MM/DD';
  27.   ShortTimeFormat := 'HH:MM:SS';
  28.   writeln(log,Format('%-24s%-16s%-128s%-128s%-128s',
  29.              [DateTimeToStr(Now),
  30.               DrBobCGI.RemoteAddress,
  31.               DrBobCGI.HttpUserAgent,
  32.               DrBobCGI.Value('ThisPage'),
  33.               DrBobCGI.Value('Referrer')]));
  34.   close(log);
  35.   if IOResult <> 0 then { skip }
  36. end.
  37.